home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18188 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.2 KB

  1. Path: newsfeed.concentric.net!news
  2. From: "Alan L. Lovejoy" <alovejoy@concentric.net>
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Re: Will Java kill C++?
  5. Date: Fri, 19 Apr 1996 01:35:08 -0700
  6. Organization: Modulation
  7. Message-ID: <3177503C.643F@concentric.net>
  8. References: <3134D499.653E@ix.netcom.com> <BLUME.96Apr16103345@zayin.cs.princeton.edu> <3175F966.167EB0E7@fernuni-hagen.de> <3176B6C5.F4D@concentric.net> <Dq3984.KBD@news.hawaii.edu>
  9. NNTP-Posting-Host: cnc009053.concentric.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01Gold (Win95; U)
  14.  
  15. Peter Hinely wrote:
  16. > In article <3176B6C5.F4D@concentric.net>,
  17. > Alan L. Lovejoy <alovejoy@concentric.net> wrote:
  18. > >
  19. > >The central point of object-oriented programming is...objects.  That is,
  20. > >the unification of value and behavior into an encapsulated object.
  21. > >
  22. > >--Alan
  23. > Behavior (implemented as methods) need not be encapsulated into objects
  24. > for a language to be object-oriented.  This corresponds to real life where
  25. > most objects do not have methods encapsulated into them.  Does a ball know
  26. > how to throw itself?  No, it is thrown by something else.  This can be
  27. > modeled in a language via generic functions which dispatch to the
  28. > appropriate method according to the argument list passed to it.
  29. >   throw( <ball> )
  30. >   throw( <something-else> )
  31.  
  32. It's true that a ball would not generally be responsibile for throwing
  33. itself.  But it's also true that not all message sends are to "self."
  34. Who throws the ball or sends the message isn't the point.  The question
  35. that matters is this: who or what is responsible for determining the 
  36. reaction to being thrown or receiving a message? 
  37.  
  38. The reaction of a ball to being thrown is determined by its nature,
  39. by what it is.  You can see this if you try throwing something really
  40. different, such as air, neutronium, negative matter or a Russian
  41. verb declension.  All these things react differently to being thrown.
  42.  
  43. The unification of value and behavior into an encapsulating object is
  44. not necessarily a physical encapsulation.  It only needs to be a logical
  45. encapsulation. If the object that is thrown, or the object that receives 
  46. a message, affects what happens as a result then its behavior is
  47. logically encapsulated.  
  48.  
  49. A value is an object not because it **contains** its behavior, but 
  50. because its behavior is a function of its identity (not necessarily its
  51. class, e.g., Self).  What matters is the fact that applying the "same" 
  52. function with arguments of different types/classes results in different
  53. behavior. The mechanisms that make that possible are irrelevant.
  54.  
  55. Self stores methods in slots of the object itself--directly mapping
  56. an object to its behavior.  Smalltalk stores methods in the class, which
  57. is stored in a hidden slot of the object--indirectly mapping an object
  58. to its behavior. Generic method systems rely on the method dispatch 
  59. mechanism to associate argument lists (by type or class, statically or
  60. dynamically determined) with the appropriate method--also an indirect
  61. mapping of objects to their behavior.  The end result is mathematically 
  62. equivalent--except that the generic method technique apparently handles 
  63. multiple dispatching better.
  64.  
  65. --Alan
  66.